package game.model.scene
{
	import game.define.NotificationName;
	import game.define.ProxyName;
	
	import org.puremvc.as3.patterns.proxy.Proxy;

	public class SceneProxy extends Proxy
	{
		public function SceneProxy(proxyName:String=null, data:Object=null)
		{
			super(ProxyName.SCENE_PROXY);
		}
		
		////////////////////////////////////////////////////////////////////////
		// config data
		private var _scenesConf:Object;
		private var _mapsConf:Object;
		
		public function setScenesConf(value:Array):void
		{
			for (var i:int=0; i<value.length; i++)
			{
				var vo:SceneConfigVO = new SceneConfigVO();
				_scenesConf[vo.id] = vo;
			}
		}
		
		public function getSceneConfig(id:int):SceneConfigVO
		{
			return _scenesConf[id];
		}
		
		public function setMapsConfig(value:Array):void
		{
			for (var i:int=0; i<value.length; i++)
			{
				var vo:MapConfigVO = new MapConfigVO();
				_scenesConf[vo.id] = vo;
			}
		}
		
		public function getMapConfig(id:int):MapConfigVO
		{
			return _mapsConf[id];
		}
		
		////////////////////////////////////////////////////////////////////////
		// user data
		private var _currentSceneId:int;
		private var _currentX:Number;
		private var _currentY:Number;
		
		public function firtEnter(id:int, x:int, y:int):void
		{
			_currentSceneId = id;
			_currentX = x;
			_currentY = y;
			
			sendNotification(NotificationName.SCENE_FIRST_ENTER);
		}
		
		public function switchScene(id:int, x:int, y:int):void
		{
			_currentSceneId = id;
			_currentX = x;
			_currentY = y;
			
			sendNotification(NotificationName.SCENE_SWITCH);
		}
		
		public function jumpScene(x:int, y:int):void
		{
			_currentX = x;
			_currentY = y;
			
			sendNotification(NotificationName.SCENE_JUMP);
		}
		
		public function get currentSceneId():int
		{
			return _currentSceneId;
		}
		
		public function get currentX():Number
		{
			return _currentX;
		}
		
		public function get currentY():Number
		{
			return _currentY;
		}
	}
}